/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package net.flowas.materialbilling.domain;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 * 商品 在 各仓库 的 库存情况
 *
 * @author Administrator
 */
@Entity
public class MaterialStock implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * @return the SUFFICIENT
     */
    public static Integer getSUFFICIENT() {
        return SUFFICIENT;
    }

    /**
     * @param aSUFFICIENT the SUFFICIENT to set
     */
    public static void setSUFFICIENT(Integer aSUFFICIENT) {
        SUFFICIENT = aSUFFICIENT;
    }

    /**
     * @return the SHORTAGE
     */
    public static Integer getSHORTAGE() {
        return SHORTAGE;
    }

    /**
     * @param aSHORTAGE the SHORTAGE to set
     */
    public static void setSHORTAGE(Integer aSHORTAGE) {
        SHORTAGE = aSHORTAGE;
    }

    /**
     * @return the EXHAUSTED
     */
    public static Integer getEXHAUSTED() {
        return EXHAUSTED;
    }

    /**
     * @param aEXHAUSTED the EXHAUSTED to set
     */
    public static void setEXHAUSTED(Integer aEXHAUSTED) {
        EXHAUSTED = aEXHAUSTED;
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private static Integer SUFFICIENT = 2;                 //充足( quantity >= safetyNum)
    private static Integer SHORTAGE = 1;                 //紧缺( 0 < quantity < safetyNum)
    private static Integer EXHAUSTED = 0;                 //无货( quantity == 0)
    //商品ID
    @ManyToOne
    private Material material;

    //仓库ID
    private String warehouseId;

    //商品在特定仓库的安全库存
    private Long safetyNum;

    //当前库存(个)
    private Long quantity;

    //库存状态: 0 1 2
    private Integer status;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MaterialStock)) {
            return false;
        }
        MaterialStock other = (MaterialStock) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "net.flowas.materialbilling.domain.MaterialStock[ id=" + id + " ]";
    }

    /**
     * @return the material
     */
    public Material getMaterial() {
        return material;
    }

    /**
     * @param material the material to set
     */
    public void setMaterial(Material material) {
        this.material = material;
    }

    /**
     * @return the warehouseId
     */
    public String getWarehouseId() {
        return warehouseId;
    }

    /**
     * @param warehouseId the warehouseId to set
     */
    public void setWarehouseId(String warehouseId) {
        this.warehouseId = warehouseId;
    }

    /**
     * @return the safetyNum
     */
    public Long getSafetyNum() {
        return safetyNum;
    }

    /**
     * @param safetyNum the safetyNum to set
     */
    public void setSafetyNum(Long safetyNum) {
        this.safetyNum = safetyNum;
    }

    /**
     * @return the quantity
     */
    public Long getQuantity() {
        return quantity;
    }

    /**
     * @param quantity the quantity to set
     */
    public void setQuantity(Long quantity) {
        this.quantity = quantity;
    }

    /**
     * @return the status
     */
    public Integer getStatus() {
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(Integer status) {
        this.status = status;
    }

}
